<?php 
include_once($_SERVER["DOCUMENT_ROOT"]."/bolsa_trabajo/util/session_control_aspirante.php");
include_once($_SERVER["DOCUMENT_ROOT"]."/bolsa_trabajo/dto/aspirante_dto.php");
include_once($_SERVER["DOCUMENT_ROOT"]."/bolsa_trabajo/util/session_helper.php");



?>


<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="utf-8">
 
<title>-SITRABS- Subir Curriculum</title>

 
	
	
	<link href="../css/bootstrap.min3.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen"
	href="../css/bootstrap3-datetimepicker.css" />


<script src="../js/bootstrap.min3.js"></script> 
<link href="../css/bootstrap.min3.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen"
	href="../css/bootstrap3-datetimepicker.css" />
 
      <script src="../js/jquery.min.js"></script> 

<script src="../js/bootstrap.min.js"></script>
<script src="../js/bootstrap3-datepicker.js"></script>
	
	
	
<script type="text/javascript">
$(document)
.on('change', '.btn-file :file', function() {
	var input = $(this),
	numFiles = input.get(0).files ? input.get(0).files.length : 1,
	label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
	input.trigger('fileselect', [numFiles, label]);
});

$(document).ready( function() {
$('.btn-file :file').on('fileselect', function(event, numFiles, label) {
	
	var input = $(this).parents('.input-group').find(':text'),
		log = numFiles > 1 ? numFiles + ' files selected' : label;
	
	if( input.length ) {
		input.val(log);
	} else {
		if( log ) alert(log);
	}
	
});
});
</script>

	<style>
		.btn-file {
		    position: relative;
		    overflow: hidden;
		}
		.btn-file input[type=file] {
		    position: absolute;
		    top: 0;
		    right: 0;
		    min-width: 100%;
		    min-height: 100%;
		    font-size: 999px;
		    text-align: right;
		    filter: alpha(opacity=0);
		    opacity: 0;
		    background: red;
		    cursor: inherit;
		    display: block;
		}
		input[readonly] {
			background-color: white !important;
			cursor: text !important;
		}
	</style>
</head>

<body>

<div class="container">
<br/>
<div class="container">
		<nav class="navbar navbar-default navbar-static">
        <div class="navbar-header">
            <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#b-menu-2">
                <span class="sr-only">Navegación</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand">Subir Curriculum</a>
        </div>

        <!-- submenu elements for #b-menu-2 -->
        <div class="collapse navbar-collapse" id="b-menu-2">
          <ul class="nav navbar-nav">
 <li><a href="../home/home_aspirante.php"><span class="glyphicon glyphicon-home"></span> Inicio</a></li>
            <li> <a href="../help_usaspir.html"><span class="glyphicon glyphicon-question-sign"></span> Ayuda</a></li>
           <li><a href="../action/action_logout.php"><span  class="glyphicon glyphicon-remove"></span>Cerrar Sesion</a></li>
        
            <li class="dropdown">
             <ul class="dropdown-menu">
 <li><a href="../home/home_aspirante.php"><span class="glyphicon glyphicon-home"></span> Inicio</a></li>
            <li> <a href="../help_usaspir.html"><span class="glyphicon glyphicon-question-sign"></span> Ayuda</a></li>
           <li><a href="../action/action_logout.php"><span  class="glyphicon glyphicon-remove"></span>Cerrar Sesion</a></li>
           </ul>
            </li>
          </ul> 
        </div><!-- /.nav-collapse -->
      </nav>
	</div>
		</div>
	<div class="container">

		<div class="span10 offset1">
			<div class="row">
				<h3>Subir Curriculum Vitae</h3>
			</div>

			<form class="form-horizontal"
				action="../action/action_subir_cv.php"
				method="post" enctype="multipart/form-data">
				 
				
				<div class="row">
					<div class="input-group">
					<span class="input-group-btn">
						<span class="btn btn-primary btn-file">
							Selecciona Archivo&hellip; <input type="file" name='fileCV' >
						</span>
					</span>
					<input type="text"class="form-control"  name="urlCV" readonly>
				</div>
				<span class="help-block">
					Seleccion el archivo que deseas subir
				</span>
				</div>
				
				
			
				<div class="form-group">
					<div class="col-md-offset-5 col-md-7">
						
						<a class="btn btn-default navbar-btn" href="<?php echo $home?>">Regresar a Inicio</a>
						<button type="submit" class="btn btn-success navbar-btn" name= "action" value="load">Subir Archivo</button>
					</div>
					
				</div>


			</form>
		</div>
		
		<div class="span10 offset1">
			<?php 
			    $urlCV = AspiranteDTO::getUrlCV($id);
			    
			    if($msgExito != null){
					echo "<div class='alert alert-success'> " .$msgExito ." </div>";
				}
				
				if($msgError != null){
					echo "<div class='alert alert-success'> " .$msgError ." </div>";
				}
			    
			    if($urlCV != null){
					echo "<div class='alert alert-info'> Ya tienes una version de CV  <a href='" .$urlCV . "' class='alert-link' target='_blank'> puedes descargar aqui!! </a> </div>";
				}
				
				SessionHelper::clearMsg();
			
			?>
			
		</div>

	</div>
 <script type="text/javascript" src="../js/bootstrap.min.js"></script> 

	<!-- /container -->
</body>
</html>
